<?php

namespace Yi\Permission\Models;

use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Auth\Authenticatable;
use Illuminate\Database\Eloquent\Model;
// use Rennokki\QueryCache\Traits\QueryCacheable;



class MiniprogramhUser extends Model implements AuthenticatableContract, JWTSubject
{
    // use QueryCacheable;
    public $cacheFor = 300;


    use Authenticatable;

    public $table =  'wechat_openid';

    protected $fillable = [
        "appid",
        "openid",
        "unionid",
        "subscribe",
        "subscribe_time",
        "subscribe_scene",
        "remark",
        "qr_scene",
        "qr_scene_str",
        "nickname",
        "avatar",
    ];

    protected $hidden = [];

    /**
     * 获取会储存到 jwt 声明中的标识
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey();
    }

    /**
     * 返回包含要添加到 jwt 声明中的自定义键值对数组
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return ['role' => 'miniprogram'];
    }
}
